#include<iostream>
#include<sys/types.h>
#include<sys/stat.h>
#include<string>
#include<fcntl.h>
#include<unistd.h>
#include"comm.hpp"
int main()
{
    int fd = open(FIFO_FILE,O_WRONLY);
    if(fd < 0)
    {
        std::cerr << "open fifo error" << std::endl;
        return 1;
    }
    //打开成功
    std::cout << "open fifo success" << std::endl;
    std::string massage;
    int cnt = 0;
    pid_t id = getpid();
    while(true)
    {
        std::cout << "please Enter#";
        std::getline(std::cin,massage);
        massage += " ,cnt = " + std::to_string(cnt++) + " ,id = " + std::to_string(id);
        int number = write(fd,massage.c_str(),massage.size());
    }
    close(fd);
    return 0;
}